/*
 * Element.h
 *
 *  Created on: 2010-6-3
 *      Author: Guobc
 */

#ifndef ELEMENT_H_
#define ELEMENT_H_

#include <string>
#include "ASTAbstractNode.h"
#include "Tag.h"
using namespace std;

namespace HA {
/**
 * This interface represents an element in the HTML document
 */
class Element: public HA::ASTAbstractNode {

public:

	Element() :
		HA::ASTAbstractNode() {

	}

	Element(ASTDom* document, int start, int end) :
		HA::ASTAbstractNode(document, start, end) {

	}
	/**
	 * Set start tag to this element.
	 * @param name The start tag.
	 */
	virtual void setStartTag(Tag& tag) = 0;

	/**
	 * Get start tag to this element.
	 * @param name The start tag.
	 */
	virtual Tag getStartTag() const = 0;

	/**
	 * Set end tag to this element.
	 * @param name The end tag name.
	 */
	virtual void setEndTag(Tag& tag) = 0;

	/**
	 * Get end tag name of this element.
	 * @param name The end tag name.
	 */
	virtual Tag getEndTag() const = 0;

	/**
	 * Set element name.
	 * @param
	 */
	virtual void setElementName(const string& name) = 0;

	/**
	 * Get element name
	 * @return
	 */
	virtual string getElementName() const = 0;

	/**
	 * Sets attribute with given key and value.
	 * @param key The key of attribute.
	 * @param value The value of attribute.
	 */
	virtual void setAttribute(const string& key, const string& value) = 0;

	/**
	 * Gets the value of attribute with given key.
	 * @param key The key of attribute.
	 */
	virtual string getAttribute(const string& key) = 0;

	/**
	 * Remove the the attribute with given key, if it exits.
	 * @param key The key of attribute.
	 */
	virtual void removeAttribute(const string& key) = 0;

	/**
	 * Return the set of names handled by this element.
	 * Since this a a generic element, it has no ids.
	 * @return The names to be matched that create elements of this type.
	 */
	virtual string* getIds() const = 0;

	/**
	 * Return the set of element names that cause this element to finish.
	 * These are the normal (non end elements) that if encountered while
	 * scanning (a composite element) will cause the generation of a virtual
	 * element.
	 * Since this a a non-composite element, the default is no enders.
	 * @return The names of following elements that stop further scanning.
	 */
	virtual string* getEnders() const = 0;

	/**
	 * Test whether this element is an empty element.
	 * An empty element has no content and it's end tag is closed in the start tag.
	 * such as '<br />' tag.
	 * @return True if has content, false otherwise.
	 */
	virtual bool isEmptyElement() = 0;

};
}

#endif /* ELEMENT_H_ */
